<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>账目列表 - 【妖精猫】后台</title>
<meta name="author" content="frankie" />

<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/list.js"></script>
<script type="text/javascript">
$().ready(function() {
	var $listForm = $("#listForm");
		
	var $typeSelect = $("#typeSelect");
	var $typeOption = $("#typeOption a");
	var $orderType = $("#orderType");
	
	var $storeSelect = $("#storeSelect");
	var $storeOption = $("#storeOption a");
	var $storeId = $("#storeId");
	
	var $statusSelect = $("#statusSelect");
	var $statusOption = $("#statusOption a");
	var $orderStatus = $("#orderStatus");
	
	// 订单类型
	$typeSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击订单类型
	$typeOption.click( function() {
		var $this = $(this);
		$orderType.val($this.attr("val"));
		$listForm.submit();
		return false;
	});

	// 店铺id
	$storeSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击店铺id
	$storeOption.click( function() {
		var $this = $(this);
		$storeId.val($this.attr("val"));
		$listForm.submit();
		return false;
	});
	
	// 订单状态
	$statusSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击订单状态
	$statusOption.click( function() {
		var $this = $(this);
		$orderStatus.val($this.attr("val"));
		$listForm.submit();
		return false;
	});

	[@flash_message /]

});
</script>
</head>
<body>
	<div class="path">
		<a href="${base}/admin/common/index.jhtml">${message("admin.path.index")}</a> &raquo; 账目列表 <span>(${message("admin.page.total", page.total)})</span>
	</div>
	<form id="listForm" action="list.jhtml" method="get">
		<div class="bar">
			<div class="buttonWrap">
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>${message("admin.common.refresh")}
				</a>
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
						${message("admin.page.pageSize")}<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="pageSizeOption">
							<li>
								<a href="javascript:;"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
							</li>
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.orderType}" id="orderType" name="orderType">
				<div class="menuWrap">
					<a href="javascript:;" id="typeSelect" class="button">
						[#if page.pageable.orderType == '']订单类型[#elseif page.pageable.orderType == 1]真实订单[#elseif page.pageable.orderType == 2]人工订单[/#if]
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="typeOption">
							<li>
								<a href="javascript:;"[#if page.pageable.orderType == ''] class="current"[/#if] val="">全部</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderType == 1] class="current"[/#if] val="1">真实</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderType == 2] class="current"[/#if] val="2">人工</a>
							</li>
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.storeId}" id="storeId" name="storeId">
				<div class="menuWrap">
					<a href="javascript:;" id="storeSelect" class="button">
						[#if page.pageable.storeId == '']店铺名称[#elseif page.pageable.storeId == 1]贾斯特曼[#elseif page.pageable.storeId == 2]真丶性情[#elseif page.pageable.storeId == 3]真性情商城[#elseif page.pageable.storeId == 4]胡佩刚[/#if]
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="storeOption">
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == ''] class="current"[/#if] val="">全部</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '1'] class="current"[/#if] val="1">贾斯特曼</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '2'] class="current"[/#if] val="2">真丶性情</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '3'] class="current"[/#if] val="3">真性情商城</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '4'] class="current"[/#if] val="4">胡佩刚</a>
							</li>
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.orderStatus}" id="orderStatus" name="orderStatus">
				<div class="menuWrap">
					<a href="javascript:;" id="statusSelect" class="button">
						[#if page.pageable.orderStatus == '']订单状态[#elseif page.pageable.orderStatus == 1]已付款[#elseif page.pageable.orderStatus == 2]未付款[/#if]
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="statusOption">
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == ''] class="current"[/#if] val="">全部</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '1'] class="current"[/#if] val="1">已付款</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '2'] class="current"[/#if] val="2">未付款</a>
							</li>
						</ul>
					</div>
				</div>
				
			</div>
			
			
			<input type="hidden" value="file" name="fileType">
			<a style="position:relative;" class="iconButton button">
				<span class="addIcon">&nbsp;</span>订单分析<input id="fileInput" type="file" name="file">
			</a>
			<script type="text/javascript">
				$fileInput = $("#fileInput");
				$fileInput.change(function() {
					extensions =  "xls,csv";  
					if (!new RegExp("^\\S.*\\.(" + extensions.replace(/,/g, "|") + ")$", "i").test($fileInput.val())) {
						alert("输入的文件格式错误！");
						return false;
					}
					$("#listForm").attr("enctype", "multipart/form-data");
			        $("#listForm").attr("encoding", "multipart/form-data");
			        $("#listForm").attr("action", "analyze.jhtml");
			        $("#listForm").attr('method', 'POST');
			        //$("#listForm")attr('target', frameId);
					$("#listForm").submit();
				});
			</script>
			
			<div class="menuWrap">
				<div class="search">
					<span id="searchPropertySelect" class="arrow">&nbsp;</span>
					<input type="text" id="searchValue" name="searchValue" value="${page.searchValue}" maxlength="200" />
					<button type="submit">&nbsp;</button>
				</div>
				<div class="popupMenu">
					<ul id="searchPropertyOption">
						<li>
							<a href="javascript:;"[#if page.searchProperty == "userName"] class="current"[/#if] val="userName">用户名</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				<th>
					<span>ID</span>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="userName">用户名</a>
				</th>
				<th>
					<span>手机号码</span>
				</th>
				<th>
					<span>金额</span>
				</th>
				<th>
					<span>店铺</span>
				</th>
				<th>
					<span>类型</span>
				</th>
				<th>
					<span>状态</span>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="orderTime">下单时间</a>
				</th>
				<th>
					<span>来源</span>
				</th>
				<th>
					<span>操作者</span>
				</th>
			</tr>
			[#list page.content as item]
				<tr>
					<td>
						<span>${item.id}</span>
					</td>
					<td>
						<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=${item.userName}&siteid=cntaobao&status=1&charset=utf-8">
							<img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=${item.userName}&site=cntaobao&s=1&charset=utf-8" alt="点这里给我发消息" />
							&nbsp;<span title="${item.goodsTitle}">${item.userName}</span>
						</a>
					</td>
					<td>
						<span>${item.mobileNumber}</span>
					</td>	
					<td>
						<span>${currency(item.realPaidFee, true)}</span>
					</td>
					<td>
						<span>[#if item.storeId == 1]贾斯特曼[#elseif item.storeId == 2]真丶性情[#elseif item.storeId == 3]真性情商城[#elseif item.storeId == 4]胡佩刚[/#if]</span>
					</td>
					<td>
						[#if item.type == 1]<span style="color:green;">真实[#elseif item.type == 2]<span style="color:red;">人工[/#if]</span>
					</td>
					<td>
						[#if item.status == 0]<span style="color:green;">未付款[#elseif item.status == 1]<span style="color:blue;">正常[#elseif item.status == 3]<span style="color:red;">已关闭[/#if]</span>
					</td>
					<td>
						<span title="${item.orderTime?string("yyyy-MM-dd")}">${item.orderTime}</span>
					</td>
					<td>
						[#if item.isMobile]<span style="color:green;">手机订单[#else]<span style="color:blue;">PC订单[/#if]</span>
					</td>
					<td>
						<span>${item.operator}</span>
					</td>
				</tr>
			[/#list]
		</table>
		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
			[#include "/admin/include/pagination.ftl"]
		[/@pagination]
	</form>
</body>
</html>